﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DroidLord.Core
{
    class PathManager
    {
        public static string  getApkDir()
        {
            string path=Directory.GetCurrentDirectory() + "\\usr\\apk";
            return path;
        }
        public static string getInputMethodApkPath()
        {
            string apkdir = getApkDir();
            string apkPath = "";
            DirectoryInfo di = new DirectoryInfo(apkdir);
            FileInfo[] fis = di.GetFiles();
            foreach(FileInfo fi in fis)
            {
                string tempapkpath=fi.FullName;
                if(fi.Name.StartsWith("inputmethod_")&&fi.Name.EndsWith(".apk"))
                {
                    apkPath = fi.FullName;
                    break;
                }
            }
            return apkPath;
        }
        public static string getApkAssetsDir()
        {
            string path = Directory.GetCurrentDirectory() + "\\usr\\apk\\assets";
            return path;
        }
        public static string getApkAssetsMobileAgentPath()
        {
            string path = Directory.GetCurrentDirectory() + "\\usr\\apk\\assets\\mobileagent";
            return path;
        }

        public static string getApkAssetsCmPath()
        {
            string path = Directory.GetCurrentDirectory() + "\\usr\\apk\\assets\\cm";
            return path;
        }

        public static string getStorageDir()
        {
            string path = Directory.GetCurrentDirectory() + "\\storage";
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            return path;
        }
        public static string getTempDir()
        {
            string path = Directory.GetCurrentDirectory() + "\\storage\\temp";
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            return path;
        }
        public static string getScreenShotDir()
        {
            string path = Directory.GetCurrentDirectory() + "\\storage\\screenshot";
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            return path;
        }

        public static string  getDBSaveDir()
        {
            string path = Directory.GetCurrentDirectory() + "\\storage\\database";
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            return path;
        }
        
        public static String getAppDBPath(String type)
        {
            string path = getDBSaveDir() + "\\" + type;
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            return path;
        }

        public static string  getDYVideoDir()
        {
            string path = Directory.GetCurrentDirectory() + "\\storage\\douyin\\video";
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            return path;
        }

        public static string  getJavaPath()
        {
            string path = Directory.GetCurrentDirectory() + "\\java\\bin\\java";
            return path;
        }
        public static string getPluginDir()
        {
            string path = Directory.GetCurrentDirectory() + "\\plugin";
            return path;
        }

        public static string  getAdbPath()
        {
            string path = Directory.GetCurrentDirectory() + "\\usr\\bin\\adb";
            return path;
        }
        public static string getCacheDir()
        {
            string path = Directory.GetCurrentDirectory() + "\\cache";
            if(!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            return path;
        }
        public static string getCacheDYDir()
        {
            string path = Directory.GetCurrentDirectory() + "\\cache\\dy";
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            return path;
        }
        public static string getCacheKSDir()
        {
            string path = Directory.GetCurrentDirectory() + "\\cache\\ks";
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            return path;
        }

        public static string getCacheDYLiveInfoPath()
        {
            string path = Directory.GetCurrentDirectory() + "\\cache\\dy\\live.txt";
           
            return path;
        }
        public static string getCacheKSLiveInfoPath()
        {
            string path = Directory.GetCurrentDirectory() + "\\cache\\ks\\live.txt";
            
            return path;
        }

        public static string getEtcDir()
        {
            string path = Directory.GetCurrentDirectory() + "\\etc";
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            return path;
        }

        public static string getEtcUAPath()
        {
            string path = Directory.GetCurrentDirectory() + "\\etc\\ua.txt";
          
            return path;
        }



        public static string  getReadMePath()
        {
            string path = Directory.GetCurrentDirectory() + "\\etc\\readme.txt";

            return path;
        }

    }
}
